import {defineStore} from "pinia"
import {ref} from 'vue'
import i18n from "../local/i18"
export const useConfigStore = defineStore('config',() => {
    // 设置当前的语言
    let language = ref(localStorage.getItem('lang') || 'zh')

    const setLanguage = (lang:any) => {
        let {locale} = i18n.global
        locale.value = lang
        language.value = lang
        localStorage.setItem('lang',lang)
    }

    return {
        language,
        setLanguage
    }
})